﻿'
' Will Strohl (will.strohl@gmail.com)
' http://www.willstrohl.com
'
'Copyright (c) 2011, Will Strohl
'All rights reserved.
'
'Redistribution and use in source and binary forms, with or without modification, are 
'permitted provided that the following conditions are met:
'
'Redistributions of source code must retain the above copyright notice, this list of 
'conditions and the following disclaimer.
'
'Redistributions in binary form must reproduce the above copyright notice, this list 
'of conditions and the following disclaimer in the documentation and/or other 
'materials provided with the distribution.
'
'Neither the name of Will Strohl, Google Plus for DotNetNuke, nor the names of its contributors may be 
'used to endorse or promote products derived from this software without specific prior 
'written permission.
'
'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
'EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
'OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
'SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
'INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
'TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
'BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
'CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
'ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
'DAMAGE.
'

Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Services.FileSystem
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Xml

Namespace WillStrohl.Modules.GooglePlus

    Public NotInheritable Class GooglePlusController
        Implements IPortable

#Region " Constants "

        Public Const SETTINGKEY_CLIENTID As String = "GooglePlus.ClientId"
        Public Const SETTINGKEY_CLIENTSECRET As String = "GooglePlus.ClientSecret"
        Public Const SETTINGKEY_APIKEY As String = "GooglePlus.ApiKey"
        Public Const SETTINGKEY_PROFILEURL As String = "GooglePlus.ProfileUrl"

#End Region

#Region " Data Access "



#End Region

#Region " IPortable Implementation "

        Public Function ExportModule(ByVal ModuleID As Integer) As String Implements DotNetNuke.Entities.Modules.IPortable.ExportModule
            Dim sb As New StringBuilder(150)
            'Dim collSlider As New SliderInfoCollection
            'collSlider = GetSliders(ModuleID)

            'sb.Append("<WillStrohl><Sliders>")
            'For Each obj As SliderInfo In collSlider
            '    sb.Append("<Slider>")

            '    sb.AppendFormat("<SliderId>{0}</SliderId>", obj.SliderId)
            '    sb.AppendFormat("<ModuleId>{0}</ModuleId>", obj.ModuleId)
            '    sb.AppendFormat("<SliderName><![CDATA[{0}]]></SliderName>", XmlUtils.XMLEncode(obj.SliderName))
            '    sb.AppendFormat("<SliderContent><![CDATA[{0}]]></SliderContent>", XmlUtils.XMLEncode(obj.SliderContent))
            '    sb.AppendFormat("<AlternateText><![CDATA[{0}]]></AlternateText>", XmlUtils.XMLEncode(obj.AlternateText))
            '    sb.AppendFormat("<DisplayOrder>{0}</DisplayOrder>", obj.DisplayOrder)
            '    sb.AppendFormat("<LastUpdatedBy>{0}</LastUpdatedBy>", obj.LastUpdatedBy)
            '    sb.AppendFormat("<LastUpdatedDate>{0}</LastUpdatedDate>", obj.LastUpdatedDate)

            '    sb.Append("</Slider>")
            'Next
            'sb.Append("</Sliders>")

            '' later on, will probably need to add module settings here

            'sb.Append("</WillStrohl>")

            Return sb.ToString
        End Function

        Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserID As Integer) Implements DotNetNuke.Entities.Modules.IPortable.ImportModule
            'Dim injContents As XmlNode = DotNetNuke.Common.Globals.GetContent(Content, "Sliders")

            'For Each xmlSlider As XmlNode In injContents.SelectNodes("Slider")
            '    Dim objSlider As New SliderInfo
            '    objSlider.ModuleId = ModuleID
            '    objSlider.SliderName = xmlSlider.SelectSingleNode("SliderName").InnerText
            '    objSlider.SliderContent = xmlSlider.SelectSingleNode("SliderContent").InnerText
            '    objSlider.AlternateText = xmlSlider.SelectSingleNode("AlternateText").InnerText
            '    objSlider.DisplayOrder = Integer.Parse(xmlSlider.SelectSingleNode("DisplayOrder").InnerText, Globalization.NumberStyles.Integer)
            '    objSlider.LastUpdatedBy = UserID
            '    objSlider.SliderId = AddSlider(objSlider)
            'Next

            ' will need to add settings here

        End Sub

#End Region

    End Class

End Namespace